
<html>
	<head>
		<title>
			
		</title>
	</head>

	<body>
		<form method="post" action="">
			String <input type="text" name="str" />
			Search <input maxlength="1" "text" name="search" />
			Replace <input maxlength="1" type="text" name="replace" />
			
		     <input type="submit" name="submit"/>
		</form><h1>
		
		<?php
	if(isset($_POST['submit' ]))
	{
		function myReplacer($word,$search,$replace)
		{
			$count=0;

			while(isset($word[$count]))
			{
				if($word[$count]==$search)
					$word[$count]=$replace;
				$count++;

			}
			return $word;
		}
		
		$string = $_POST['str'];
		$search = $_POST['search'];
		$replace = $_POST['replace'];
     
	    echo myReplacer($string, $search, $replace);

	}
		
		?>
	</h1>
		
	</body>
</html>